﻿using Common;
using SuperSocket.SocketBase;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WorldServer.Server
{
    /// <summary>
    /// 存放用户等功能..
    /// </summary>
    public class MapleWorldServer
    {
        /// <summary>
        /// 客户端列表
        /// </summary>
        private static List<MapleClient> m_ClientList = new List<MapleClient>();

        public static List<IBootstrap> m_ChannelList = new List<IBootstrap>();

        //Dictionary<string,>


        /// <summary>
        /// 通过SessionID查找玩家客户端
        /// </summary>
        /// <param name="session"></param>
        /// <returns></returns>
        public static MapleClient GetClinet(Common.Server.MapleSession session)
        {
            for (int i = 0; i < m_ClientList.Count; i++)
            {
                if (m_ClientList[i].GetSession().GetSessionID() == session.GetSessionID())
                {
                    return m_ClientList[i];
                }
            }
            return null;
        }

        /// <summary>
        /// 添加一个客户端
        /// </summary>
        /// <param name="clinet"></param>
        public static void AddClient(MapleClient Client)
        {
            m_ClientList.Add(Client);
        }
    }
}
